package de.lgohlke;

/**
 *
 */

import org.hibernate.MappingException;

/**
 * <p>TestException class.</p>
 *
 * @author Lars Gohlke
 * @version $Id: $
 * @since 0.0.1
 */
public class TestException extends Exception
{

	private static final long	serialVersionUID	= -588581453977570013L;

	/**
	 * <p>Constructor for TestException.</p>
	 */
	public TestException()
	{
		this(null, null);
	}

	/**
	 * <p>Constructor for TestException.</p>
	 *
	 * @param message a {@link java.lang.String} object.
	 */
	public TestException(String message)
	{
		this(message, null);
	}

	/**
	 * <p>Constructor for TestException.</p>
	 *
	 * @param cause a {@link java.lang.Throwable} object.
	 */
	public TestException(Throwable cause)
	{
		this("", cause);
	}

	/**
	 * <p>Constructor for TestException.</p>
	 *
	 * @param message a {@link java.lang.String} object.
	 * @param cause a {@link java.lang.Throwable} object.
	 */
	public TestException(String message, Throwable cause)
	{
		if (cause == null)
		{
			printStackTrace();
		}
		else
		{
			if (cause instanceof MappingException && cause.getMessage().startsWith("Unknown Entity:"))
			{
				System.err.println(cause.getMessage());
			}
			else
			{
				System.err.println(message);
				printStackTrace();
			}
		}
	}

}
